﻿@using xConnected.Common
@using xConnected.Core.Model
<script type="text/javascript">
    $(window).load(function () {
        var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName] == null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
        var username = "@((Session["User"] as User).Username)";
        
        $('#profile_photo_file').uploadify({
            uploader: '/Scripts/uploadify/uploadify.swf',
            cancelImg: '/Scripts/uploadify/cancel.png',
            buttonText: '@Resources.SelectImage',
            script: '/Uploadify/UploadProfilePhoto',
            folder: 'Uploads',
            fileDesc: 'Images',
            fileExt: '*.jpg;*.jpeg;*.gif;*.png',
            multi: false,
            auto: true,
            removeCompleted: false,
            queueID: 'profile_photo_custom_queue',
            sizeLimit: 5000000,
            scriptAccess: 'always', //testing locally. comment before deploy
            scriptData: { username: username, token: auth },
            onComplete  : function(event, ID, fileObj, response, data) {
                $("#profile_photo_path").val(fileObj.filePath);
            }
        });
    }
);
</script>
 <div>
    <div id="profile_photo_status_message"></div>
    <div id="profile_photo_custom_queue" class="uploadifyQueue"></div>
</div>
        
<input id="profile_photo_file" type="file" name="profile_photo_file" />
